var gulp = require("gulp");
var cssmin = require("gulp-cssmin");
var uglify = require("gulp-uglify");
var imgmin = require("gulp-tinypng-nokey");

//css压缩
gulp.task("perfect", () => {
  gulp.src("src/*/*.html").pipe(gulp.dest("dist"));

  gulp.src("src/*/*.{json,ttf}").pipe(gulp.dest("dist"));

  gulp.src("src/*/*/*.{eot,svg,ttf,woff,woff2}").pipe(gulp.dest("dist"));

  gulp
    .src("src/*/*.{png,jpg,jpeg,gif,ico}")
    .pipe(imgmin())
    .pipe(gulp.dest("dist"));
  gulp
    .src("src/*/*/*.{png,jpg,jpeg,gif,ico}")
    .pipe(imgmin())
    .pipe(gulp.dest("dist"));
  gulp
    .src("src/*/*/*/*.{png,jpg,jpeg,gif,ico}")
    .pipe(imgmin())
    .pipe(gulp.dest("dist"));

  gulp.src("src/*/*/*.css").pipe(cssmin()).pipe(gulp.dest("dist"));

  gulp.src("src/*/*.css").pipe(cssmin()).pipe(gulp.dest("dist"));

  gulp.src("src/*/*/*.js").pipe(uglify()).pipe(gulp.dest("dist"));

  gulp.src("src/*/*.js").pipe(uglify()).pipe(gulp.dest("dist"));
});

